/******************************************************************************
 * @File name   :      MemCachedController.java
 *
 * @Author      :      Brenda Yin
 *
 * @Date        :      Jul 27, 2012
 *
 * @Copyright Notice: 
 * Copyright (c) 2014 DMS, Inc. All  Rights Reserved.
 * This software is published under the terms of the DMS Software
 * License version 1.0, a copy of which has been included with this
 * distribution in the LICENSE.txt file.
 * 
 * 
 * ----------------------------------------------------------------------------
 * Date                   Who         Version        Comments
 * Jul 27, 2012 9:55:41 AM        Brenda Yin     1.0            Initial Version
 *****************************************************************************/
package com.cap.bts.framework.common.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cap.bts.framework.cache.util.CacheUtil;
import com.cap.bts.framework.common.exception.AppException;

/**
 *
 */
@Controller
@RequestMapping(value = "/cache")
public class MemCachedController {

	/**
	 * 
	 * @Date        :      Jul 27, 2012
	 * @return
	 * @throws AppException
	 */
	@RequestMapping(value="clearAll", method = RequestMethod.GET)
	@ResponseBody
	public String clearAll() throws AppException{
		CacheUtil.clearAllCache();
		return "success";
	}
	
	@RequestMapping(value = "/clearBy", method = RequestMethod.GET)
	@ResponseBody
	public String clearByKey(@RequestParam("key") String key) throws AppException {
		CacheUtil.removeCache(key);
		return "success";
	}
}
